fix-tests-no-default-features
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Tue, 25 Oct 2022 00:11:21 +0000 (20:11 -0400)
committerAlexander Kjäll <alexander.kjall@gmail.com>
Tue, 25 Oct 2022 00:11:21 +0000 (20:11 -0400)
===================================================================

Gbp-Pq: Name fix-tests-no-default-features.patch

22 files changed:
src/aead/aes.rs
src/aead/chacha.rs
src/aead/poly1305.rs
src/arithmetic/bigint.rs
src/ec/suite_b/ecdsa/digest_scalar.rs
src/ec/suite_b/ecdsa/signing.rs
src/ec/suite_b/ecdsa/verification.rs
src/ec/suite_b/ops.rs
src/ec/suite_b/public_key.rs
src/lib.rs
src/limb.rs
src/rsa/padding.rs
src/test.rs
tests/aead_tests.rs
tests/agreement_tests.rs
tests/digest_tests.rs
tests/ecdsa_tests.rs
tests/ed25519_tests.rs
tests/hkdf_tests.rs
tests/hmac_tests.rs
tests/pbkdf2_tests.rs
tests/quic_tests.rs

index 5028e242c271a78e0c32ceb563b3b9cda015d988..49233238e5e371829f7f03fc89d98329827cd36d 100644 (file)
@@ -409,6 +409,7 @@ fn detect_implementation(cpu_features: cpu::Features) -> Implementation {
 }
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
     use super::{super::BLOCK_LEN, *};
     use crate::test;
index 668c41d854adb1fbb735d6c9c71f7b53655d8005..4e95fcae00eea30a91eebbdf0fa251603d53bdef 100644 (file)
@@ -157,6 +157,7 @@ mod tests {
     // This test exists largely as a canary for detecting if/when that type of
     // problem spreads to other platforms.
     #[test]
+    #[cfg(feature = "alloc")]
     pub fn chacha20_tests() {
         test::run(test_file!("chacha_tests.txt"), |section, test_case| {
             assert_eq!(section, "");
index a87f709a4d4a474e58cda03dd3e1eda88c6df70e..6758a90e5846515481bcdf74f3d4117fbca35615 100644 (file)
@@ -129,6 +129,7 @@ pub(super) fn sign(key: Key, input: &[u8]) -> Tag {
 }
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
     use super::*;
     use crate::test;
index 620595effd50423c416d26971ff3bf4ad7f4e04f..b639c6ffe05269d640986382b59d15e390e4a615 100644 (file)
@@ -1404,6 +1404,7 @@ mod tests {
     unsafe impl PublicModulus for M {}
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_elem_exp_consttime() {
         test::run(
             test_file!("bigint_elem_exp_consttime_tests.txt"),
@@ -1432,6 +1433,7 @@ mod tests {
     // In the meantime, the function is tested indirectly via the RSA
     // verification and signing tests.
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_elem_mul() {
         test::run(
             test_file!("bigint_elem_mul_tests.txt"),
@@ -1455,6 +1457,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_elem_squared() {
         test::run(
             test_file!("bigint_elem_squared_tests.txt"),
@@ -1476,6 +1479,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_elem_reduced() {
         test::run(
             test_file!("bigint_elem_reduced_tests.txt"),
@@ -1502,6 +1506,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_elem_reduced_once() {
         test::run(
             test_file!("bigint_elem_reduced_once_tests.txt"),
index 133e7da5dfb9b06245c334f0ae07211ac87ac01c..a5bc55763f55818ca88007e72af613e025838f10 100644 (file)
@@ -75,6 +75,7 @@ fn digest_scalar_(ops: &ScalarOps, digest: &[u8]) -> Scalar {
 }
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
     use super::digest_bytes_scalar;
     use crate::{
index 5422e06b16596eb86a471b8f92e18ce67eecef3d..6219322556a9492bd82df91ea416e1e776c64fa1 100644 (file)
@@ -514,6 +514,7 @@ static EC_PUBLIC_KEY_P384_PKCS8_V1_TEMPLATE: pkcs8::Template = pkcs8::Template {
 };
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
     use crate::{signature, test};
 
index be551e695d039a3c4b77a43d3cbc6061df734067..476fc4474a57d091d832df6cc740e577d5a574c9 100644 (file)
@@ -285,7 +285,9 @@ pub static ECDSA_P384_SHA384_ASN1: EcdsaVerificationAlgorithm = EcdsaVerificatio
 };
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
+    extern crate alloc;
     use super::*;
     use crate::test;
     use alloc::vec::Vec;
index 13d80c0d2e408e668606f9e02ae2a56920793e14..0d134acd8076892f0fe5da30c83ed5f5c70cced0 100644 (file)
@@ -465,6 +465,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_elem_add_test() {
         elem_add_test(
             &p256::PUBLIC_SCALAR_OPS,
@@ -473,6 +474,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_elem_add_test() {
         elem_add_test(
             &p384::PUBLIC_SCALAR_OPS,
@@ -480,6 +482,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn elem_add_test(ops: &PublicScalarOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -505,6 +508,7 @@ mod tests {
     // the point arithmetic functions. Thus, we can't test it.
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_elem_sub_test() {
         extern "C" {
             fn GFp_p384_elem_sub(r: *mut Limb, a: *const Limb, b: *const Limb);
@@ -516,6 +520,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn elem_sub_test(
         ops: &CommonOps,
         elem_sub: unsafe extern "C" fn(r: *mut Limb, a: *const Limb, b: *const Limb),
@@ -556,6 +561,7 @@ mod tests {
     // into the point arithmetic functions. Thus, we can't test it.
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_elem_div_by_2_test() {
         extern "C" {
             fn GFp_p384_elem_div_by_2(r: *mut Limb, a: *const Limb);
@@ -567,6 +573,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn elem_div_by_2_test(
         ops: &CommonOps,
         elem_div_by_2: unsafe extern "C" fn(r: *mut Limb, a: *const Limb),
@@ -590,6 +597,7 @@ mod tests {
 
     // TODO: Add test vectors that test the range of values above `q`.
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_elem_neg_test() {
         extern "C" {
             fn GFp_nistz256_neg(r: *mut Limb, a: *const Limb);
@@ -602,6 +610,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_elem_neg_test() {
         extern "C" {
             fn GFp_p384_elem_neg(r: *mut Limb, a: *const Limb);
@@ -613,6 +622,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn elem_neg_test(
         ops: &CommonOps,
         elem_neg: unsafe extern "C" fn(r: *mut Limb, a: *const Limb),
@@ -647,15 +657,18 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_elem_mul_test() {
         elem_mul_test(&p256::COMMON_OPS, test_file!("ops/p256_elem_mul_tests.txt"));
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_elem_mul_test() {
         elem_mul_test(&p384::COMMON_OPS, test_file!("ops/p384_elem_mul_tests.txt"));
     }
 
+    #[cfg(feature = "alloc")]
     fn elem_mul_test(ops: &CommonOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -671,6 +684,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_scalar_mul_test() {
         scalar_mul_test(
             &p256::SCALAR_OPS,
@@ -679,6 +693,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_scalar_mul_test() {
         scalar_mul_test(
             &p384::SCALAR_OPS,
@@ -686,6 +701,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn scalar_mul_test(ops: &ScalarOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -701,6 +717,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_scalar_square_test() {
         extern "C" {
             fn GFp_p256_scalar_sqr_rep_mont(r: *mut Limb, a: *const Limb, rep: Limb);
@@ -715,6 +732,7 @@ mod tests {
     // XXX: There's no `p384_scalar_square_test()` because there's no dedicated
     // `GFp_p384_scalar_sqr_rep_mont()`.
 
+    #[cfg(feature = "alloc")]
     fn scalar_square_test(
         ops: &ScalarOps,
         sqr_rep: unsafe extern "C" fn(r: *mut Limb, a: *const Limb, rep: Limb),
@@ -760,6 +778,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_sum_test() {
         point_sum_test(
             &p256::PRIVATE_KEY_OPS,
@@ -768,6 +787,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_point_sum_test() {
         point_sum_test(
             &p384::PRIVATE_KEY_OPS,
@@ -775,6 +795,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn point_sum_test(ops: &PrivateKeyOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -795,6 +816,7 @@ mod tests {
     // multiplication to use.
     #[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_sum_mixed_test() {
         extern "C" {
             fn GFp_nistz256_point_add_affine(
@@ -813,6 +835,7 @@ mod tests {
     // XXX: There is no `GFp_nistz384_point_add_affine()`.
 
     #[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
+    #[cfg(feature = "alloc")]
     fn point_sum_mixed_test(
         ops: &PrivateKeyOps,
         point_add_affine: unsafe extern "C" fn(
@@ -841,6 +864,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_double_test() {
         extern "C" {
             fn GFp_nistz256_point_double(
@@ -856,6 +880,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_point_double_test() {
         extern "C" {
             fn GFp_nistz384_point_double(
@@ -870,6 +895,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn point_double_test(
         ops: &PrivateKeyOps,
         point_double: unsafe extern "C" fn(
@@ -896,6 +922,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_mul_test() {
         point_mul_tests(
             &p256::PRIVATE_KEY_OPS,
@@ -904,6 +931,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_point_mul_test() {
         point_mul_tests(
             &p384::PRIVATE_KEY_OPS,
@@ -911,6 +939,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn point_mul_tests(ops: &PrivateKeyOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -929,6 +958,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_mul_serialized_test() {
         point_mul_serialized_test(
             &p256::PRIVATE_KEY_OPS,
@@ -937,6 +967,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn point_mul_serialized_test(
         priv_ops: &PrivateKeyOps,
         pub_ops: &PublicKeyOps,
@@ -978,6 +1009,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p256_point_mul_base_test() {
         point_mul_base_tests(
             &p256::PRIVATE_KEY_OPS,
@@ -986,6 +1018,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn p384_point_mul_base_test() {
         point_mul_base_tests(
             &p384::PRIVATE_KEY_OPS,
@@ -993,6 +1026,7 @@ mod tests {
         );
     }
 
+    #[cfg(feature = "alloc")]
     fn point_mul_base_tests(ops: &PrivateKeyOps, test_file: test::File) {
         test::run(test_file, |section, test_case| {
             assert_eq!(section, "");
@@ -1033,6 +1067,7 @@ mod tests {
         }
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_jacobian_point(
         ops: &PrivateKeyOps,
         test_case: &mut test::TestCase,
@@ -1054,6 +1089,7 @@ mod tests {
     }
 
     #[cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))]
+    #[cfg(feature = "alloc")]
     fn consume_affine_point(
         ops: &PrivateKeyOps,
         test_case: &mut test::TestCase,
@@ -1070,6 +1106,7 @@ mod tests {
         p
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_point_elem(ops: &CommonOps, limbs_out: &mut [Limb], elems: &[&str], i: usize) {
         let bytes = test::from_hex(elems[i]).unwrap();
         let bytes = untrusted::Input::from(&bytes);
@@ -1084,6 +1121,7 @@ mod tests {
         Affine(Elem<R>, Elem<R>),
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_point(ops: &PrivateKeyOps, test_case: &mut test::TestCase, name: &str) -> TestPoint {
         fn consume_point_elem(ops: &CommonOps, elems: &[&str], i: usize) -> Elem<R> {
             let bytes = test::from_hex(elems[i]).unwrap();
@@ -1130,6 +1168,7 @@ mod tests {
         }
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_elem(ops: &CommonOps, test_case: &mut test::TestCase, name: &str) -> Elem<R> {
         let bytes = consume_padded_bytes(ops, test_case, name);
         let bytes = untrusted::Input::from(&bytes);
@@ -1142,12 +1181,14 @@ mod tests {
         }
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_scalar(ops: &CommonOps, test_case: &mut test::TestCase, name: &str) -> Scalar {
         let bytes = test_case.consume_bytes(name);
         let bytes = untrusted::Input::from(&bytes);
         scalar_parse_big_endian_variable(ops, AllowZero::Yes, bytes).unwrap()
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_scalar_mont(
         ops: &CommonOps,
         test_case: &mut test::TestCase,
@@ -1164,6 +1205,7 @@ mod tests {
         }
     }
 
+    #[cfg(feature = "alloc")]
     fn consume_padded_bytes(
         ops: &CommonOps,
         test_case: &mut test::TestCase,
index 5bafa36039c38e6989aa01f3265382b74f31b5d8..536c61a88bce8988eece6f660bb1ba5d5405d666 100644 (file)
@@ -70,6 +70,7 @@ mod tests {
     use crate::test;
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn parse_uncompressed_point_test() {
         test::run(
             test_file!("suite_b_public_key_tests.txt"),
index cc66d73c3f72efeef2d9d3dd924573c97254e57e..efdd84e0d348708ea461e680d33fa87f4770e958 100644 (file)
@@ -73,7 +73,7 @@
 #![forbid(unused_results)]
 #![no_std]
 
-#[cfg(feature = "alloc")]
+#[cfg(any(feature = "alloc",test))]
 extern crate alloc;
 
 #[macro_use]
index eb5aed5fa49f415e93d82f50684e78cac7e281e4..9bc33c673293f1d341ef9e7fbf619d2847745fb7 100644 (file)
@@ -353,6 +353,7 @@ mod tests {
     const MAX: Limb = LimbMask::True as Limb;
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_limbs_are_even() {
         static EVENS: &[&[Limb]] = &[
             &[],
@@ -416,6 +417,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_limbs_equal_limb() {
         for zero in ZEROES {
             assert_eq!(limbs_equal_limb_constant_time(zero, 0), LimbMask::True);
@@ -579,6 +581,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_limbs_minimal_bits() {
         const ALL_ONES: Limb = LimbMask::True as Limb;
         static CASES: &[(&[Limb], usize)] = &[
index f6b4cf6c746c5c376b02e84d8afffa44f1940af0..d11f762785533474f718dc5091851a422624e67d 100644 (file)
@@ -523,6 +523,7 @@ mod test {
     use alloc::vec;
 
     #[test]
+    #[cfg(feature = "alloc")]
     fn test_pss_padding_verify() {
         test::run(
             test_file!("rsa_pss_padding_tests.txt"),
index 304968840c39902fdbbeaae0082a15010717284e..96bd15925bd834a58ab7b88c0d1bcf2bf71b5ad1 100644 (file)
@@ -541,6 +541,7 @@ pub mod rand {
 }
 
 #[cfg(test)]
+#[cfg(feature = "alloc")]
 mod tests {
     use crate::{error, test};
 
index 75e0e9e92d0ea4cef4d0acb056e48160af8cf206..1d3b92b5ba9e79ab1dfd19ec96d7e482ed941fdd 100644 (file)
@@ -21,10 +21,14 @@ use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
 wasm_bindgen_test_configure!(run_in_browser);
 
 use core::ops::RangeFrom;
-use ring::{aead, error, test, test_file};
+use ring::{aead, error, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 fn aead_aes_gcm_128() {
     test_aead(
         &aead::AES_128_GCM,
@@ -42,6 +46,7 @@ fn aead_aes_gcm_128() {
 
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 fn aead_aes_gcm_256() {
     test_aead(
         &aead::AES_256_GCM,
@@ -64,6 +69,7 @@ fn aead_aes_gcm_256() {
     target_arch = "x86"
 ))]
 #[test]
+#[cfg(feature = "alloc")]
 fn aead_chacha20_poly1305() {
     test_aead(
         &aead::CHACHA20_POLY1305,
@@ -79,6 +85,7 @@ fn aead_chacha20_poly1305() {
     );
 }
 
+#[cfg(feature = "alloc")]
 fn test_aead<Seal, Open>(
     aead_alg: &'static aead::Algorithm,
     seal: Seal,
@@ -335,6 +342,7 @@ fn test_aead_nonce_sizes() -> Result<(), error::Unspecified> {
 ))]
 #[allow(clippy::range_plus_one)]
 #[test]
+#[cfg(feature = "alloc")]
 fn aead_chacha20_poly1305_openssh() {
     // TODO: test_aead_key_sizes(...);
 
index 416201537843dc54450bbcb7c9cfd437cef966e6..556d220ebbbffd81680a4bb1a267c15638bd682f 100644 (file)
 
 extern crate alloc;
 
-use ring::{agreement, error, rand, test, test_file};
+use ring::{agreement, error, rand, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[test]
 fn agreement_traits() {
@@ -60,6 +63,7 @@ fn agreement_traits() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn agreement_agree_ephemeral() {
     let rng = rand::SystemRandom::new();
 
@@ -120,6 +124,7 @@ fn agreement_agree_ephemeral() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn test_agreement_ecdh_x25519_rfc_iterated() {
     let mut k = h("0900000000000000000000000000000000000000000000000000000000000000");
     let mut u = k.clone();
@@ -187,6 +192,7 @@ fn x25519_(private_key: &[u8], public_key: &[u8]) -> Result<Vec<u8>, error::Unsp
     )
 }
 
+#[cfg(feature = "alloc")]
 fn h(s: &str) -> Vec<u8> {
     match test::from_hex(s) {
         Ok(v) => v,
index c275de70547e3e0d953d920a4090700877d199be..e212fb4a3b72ff3c14b612b5a1686ddef10ed6ca 100644 (file)
 // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-use ring::{digest, test, test_file};
+use ring::{digest, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[cfg(target_arch = "wasm32")]
 use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
@@ -23,6 +26,7 @@ wasm_bindgen_test_configure!(run_in_browser);
 /// Test vectors from BoringSSL, Go, and other sources.
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 fn digest_misc() {
     test::run(test_file!("digest_tests.txt"), |section, test_case| {
         assert_eq!(section, "");
@@ -47,6 +51,7 @@ fn digest_misc() {
     });
 }
 
+#[cfg(feature = "alloc")]
 mod digest_shavs {
     use ring::{digest, test};
 
@@ -85,6 +90,7 @@ mod digest_shavs {
 
                 #[test]
                 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+                #[cfg(feature = "alloc")]
                 fn short_msg_known_answer_test() {
                     run_known_answer_test(
                         &digest::$algorithm_name,
@@ -98,6 +104,7 @@ mod digest_shavs {
 
                 #[test]
                 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+                #[cfg(feature = "alloc")]
                 fn long_msg_known_answer_test() {
                     run_known_answer_test(
                         &digest::$algorithm_name,
@@ -111,6 +118,7 @@ mod digest_shavs {
 
                 #[test]
                 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+                #[cfg(feature = "alloc")]
                 fn monte_carlo_test() {
                     run_monte_carlo_test(
                         &digest::$algorithm_name,
index 317fdbc9380658708bdf042c0b082eaf238f3ce8..49a387bd12f810bcaf925ed07baf01df6aa7feaf 100644 (file)
 use ring::{
     rand,
     signature::{self, KeyPair},
-    test, test_file,
+    test,
 };
 
+#[cfg(feature = "alloc")]
+use ring::test_file;
+
 // ECDSA *signing* tests are in src/ec/ecdsa/signing.rs.
 
 #[test]
+#[cfg(feature = "alloc")]
 fn ecdsa_from_pkcs8_test() {
     test::run(
         test_file!("ecdsa_from_pkcs8_tests.txt"),
@@ -109,6 +113,7 @@ fn ecdsa_generate_pkcs8_test() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn signature_ecdsa_verify_asn1_test() {
     test::run(
         test_file!("ecdsa_verify_asn1_tests.txt"),
@@ -142,6 +147,7 @@ fn signature_ecdsa_verify_asn1_test() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn signature_ecdsa_verify_fixed_test() {
     test::run(
         test_file!("ecdsa_verify_fixed_tests.txt"),
@@ -211,6 +217,7 @@ fn ecdsa_test_public_key_coverage() {
 // signature verifies correctly. The known-answer tests themselves are in
 // ecsda/signing.rs.
 #[test]
+#[cfg(feature = "alloc")]
 fn signature_ecdsa_sign_fixed_sign_and_verify_test() {
     let rng = rand::SystemRandom::new();
 
@@ -265,6 +272,7 @@ fn signature_ecdsa_sign_fixed_sign_and_verify_test() {
 // signature verifies correctly. The known-answer tests themselves are in
 // ecsda/signing.rs.
 #[test]
+#[cfg(feature = "alloc")]
 fn signature_ecdsa_sign_asn1_test() {
     let rng = rand::SystemRandom::new();
 
index 2741ca0429883ed897ed77d582f37527c265aba4..4809cabbeb895f1216cd9ebfcca7b20b90953a6a 100644 (file)
 use ring::{
     error,
     signature::{self, Ed25519KeyPair, KeyPair},
-    test, test_file,
+    test,
 };
 
+#[cfg(feature = "alloc")]
+use ring::test_file;
+
 /// Test vectors from BoringSSL.
 #[test]
+#[cfg(feature = "alloc")]
 fn test_signature_ed25519() {
     test::run(test_file!("ed25519_tests.txt"), |section, test_case| {
         assert_eq!(section, "");
@@ -113,6 +117,7 @@ fn test_ed25519_from_seed_and_public_key_misuse() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn test_ed25519_from_pkcs8_unchecked() {
     // Just test that we can parse the input.
     test::run(
@@ -135,6 +140,7 @@ fn test_ed25519_from_pkcs8_unchecked() {
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn test_ed25519_from_pkcs8() {
     // Just test that we can parse the input.
     test::run(
index 88435a845e9bf44b6aba7c81862ceef07c8033d1..be26c90f96f8933a94c48936f4020356a3ed46e7 100644 (file)
 // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-use ring::{digest, error, hkdf, test, test_file};
+use ring::{digest, error, hkdf, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[cfg(target_arch = "wasm32")]
 use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
@@ -22,6 +25,7 @@ wasm_bindgen_test_configure!(run_in_browser);
 
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 fn hkdf_tests() {
     test::run(test_file!("hkdf_tests.txt"), |section, test_case| {
         assert_eq!(section, "");
index 486a90a5304b8852ff02b1f0d949ddbdcf552404..4e9f14c2266d01a0581f64c78a65e99f2d9931e6 100644 (file)
 // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-use ring::{digest, error, hmac, test, test_file};
+use ring::{digest, error, hmac, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[cfg(target_arch = "wasm32")]
 use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
@@ -22,6 +25,7 @@ wasm_bindgen_test_configure!(run_in_browser);
 
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 fn hmac_tests() {
     test::run(test_file!("hmac_tests.txt"), |section, test_case| {
         assert_eq!(section, "");
index 13300fa46e1cf0026882ab2b361994e1f07f0c9b..b7cef3855c65358e24ed9d08c73c06183287223c 100644 (file)
 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 use core::num::NonZeroU32;
-use ring::{digest, error, pbkdf2, test, test_file};
+use ring::{digest, error, pbkdf2, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[cfg(target_arch = "wasm32")]
 use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
@@ -24,6 +27,7 @@ wasm_bindgen_test_configure!(run_in_browser);
 /// Test vectors from BoringSSL, Go, and other sources.
 #[test]
 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+#[cfg(feature = "alloc")]
 pub fn pbkdf2_tests() {
     test::run(test_file!("pbkdf2_tests.txt"), |section, test_case| {
         assert_eq!(section, "");
index 545d7a76fbf75f95b6c3f5c0f34a12210e339d1a..37b42f76a45ad54ba13531e355ec2e6765e31adc 100644 (file)
 // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-use ring::{aead::quic, test, test_file};
+use ring::{aead::quic, test};
+
+#[cfg(feature = "alloc")]
+use ring::test_file;
 
 #[test]
+#[cfg(feature = "alloc")]
 fn quic_aes_128() {
     test_quic(&quic::AES_128, test_file!("quic_aes_128_tests.txt"));
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn quic_aes_256() {
     test_quic(&quic::AES_256, test_file!("quic_aes_256_tests.txt"));
 }
 
 #[test]
+#[cfg(feature = "alloc")]
 fn quic_chacha20() {
     test_quic(&quic::CHACHA20, test_file!("quic_chacha20_tests.txt"));
 }
 
+#[cfg(feature = "alloc")]
 fn test_quic(alg: &'static quic::Algorithm, test_file: test::File) {
     test_sample_len(alg);